---
title: 'end | Cypress Documentation'
description: End a chain of commands in Cypress.
sidebar_label: end
---

<ProductHeading product="app" />

# end

End a chain of commands.

## Syntax

```javascript
.end()
```

### Usage

<Icon name="check-circle" color="green" /> **Correct Usage**

```javascript
cy.contains('ul').end() // Yield 'null' instead of 'ul' element
```

<Icon name="exclamation-triangle" color="red" /> **Incorrect Usage**

```javascript
cy.end()
```

<HeaderYields />

- `.end()` yields `null`.

## Examples

`.end()` is useful when you want to end a chain of commands and force the next
command to not receive what was yielded in the previous command.

```javascript
cy.contains('User: Cheryl')
  .click()
  .end() // yield null
  .contains('User: Charles')
  .click() // contains looks for content in document now
```

Alternatively, you can always start a new chain of commands off of `cy`.

```javascript
cy.contains('User: Cheryl').click()
cy.contains('User: Charles').click() // contains looks for content in document now
```

## Rules

<HeaderRequirements />

- `.end()` requires being chained off a previous command.

<HeaderAssertions />

- `.end()` cannot have any assertions chained.

<HeaderTimeouts />

- `.end()` cannot time out.

## Command Log

- `.end()` does _not_ log in the Command Log

## See also

- [`.root()`](/api/commands/root)
- [`.within()`](/api/commands/within)
